package com.sixmac.controller;

import com.sixmac.common.base.BaseController;
import com.sixmac.core.plugins.dao.Db;
import com.sixmac.core.toolbox.CMap;
import com.sixmac.core.toolbox.ajax.AjaxResult;
import com.sixmac.core.toolbox.cache.CacheKit;
import com.sixmac.core.toolbox.cache.ILoader;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by admin on 2018/6/9.
 */
@Controller
@RequestMapping("/customer")
public class CustomeController extends BaseController {

    @RequestMapping("/dicTreeList")
    @ResponseBody
    public AjaxResult dicTreeList() {
        AjaxResult res = new AjaxResult();
        String sql = "select id,name,pid as pId ,'false' as open from t_category where id !=1";
        List<Map> lists = Db.selectList(sql);

        return res.setData(lists);
    }

    @RequestMapping("/getCategoryNameById")
    @ResponseBody
    public AjaxResult getCategoryNameById(String id) {
        String sql = "select id  from t_category  where id = " + id;
        Map map = Db.selectOne(sql);
        return  json(map);
    }


}
